home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VCM / VCM.MDB / VcmComponentContainer / 19_Cabinet / Prefer.asp next >
Encoding:
Text File  |  1998-05-18  |  3.7 KB  |  131 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2.  
  3. <%
  4. '    ************************************************
  5. '    After the form posts back to this ASP, the
  6. '    values are written to a cookie.
  7. '    ************************************************
  8. If Len(Request("BGColor")) > 0 then
  9.     Response.Cookies("BGColor") = Request("BGColor")
  10.     Response.Cookies("FGColor") = Request("FGColor")
  11. End If
  12.  
  13. '    ************************************************
  14. '    If this ASP has not been run before, there will
  15. '    not be any cookies saved.  The index values for
  16. '    the drop-down select boxes are set to zero.
  17. '    ************************************************
  18. If Request.Cookies("intBGColor") = "" then
  19.     intBG = 0
  20.     intFG = 0
  21. Else
  22.     intBG = Request.Cookies("intBGColor")
  23.     intFG = Request.Cookies("intFGColor")
  24. End If
  25.  
  26. %>
  27.  
  28. <script LANGUAGE="Javascript">
  29. /*    
  30.     ************************************************
  31.     This function is used to set the color of the 
  32.     drop-down select boxes. The values are retrieved
  33.     from a cookie stored on the client machine.
  34.     ************************************************
  35. */
  36.     function setcolor() {
  37.         document.Pref.BGColor.selectedIndex = <%=intBG%>;
  38.         document.Pref.FGColor.selectedIndex = <%=intFG%>;
  39.     }
  40.  
  41. /*    
  42.     ************************************************
  43.     This function is used to write the index value
  44.     of the drop-down select boxes into a cookie.  
  45.     ************************************************
  46. */
  47.  
  48.     function writecookie() {
  49.         document.cookie = "intBGColor" + "=" + document.Pref.BGColor.selectedIndex;
  50.         document.cookie = "intFGColor" + "=" + document.Pref.FGColor.selectedIndex;
  51.     }
  52.  
  53. </script>
  54.  
  55. <html>
  56. <head>
  57. <meta NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  58.  
  59. <title>Document Title</title>
  60. </head>
  61. <!-- Sets the background color of the window to the value stored in a cookie -->
  62. <body BGCOLOR="<%= Request.Cookies("BGColor")%>" ONLOAD="setcolor()">
  63.  
  64. <!-- Sets the font color to the value stored in a cookie -->
  65. <font FACE="Arial, Helvetica, Verdana" COLOR="<%=Request.Cookies("FGColor")%>">
  66.  
  67. <!-- This form posts to this same ASP to reload based on selected values -->
  68. <form NAME="Pref" ACTION="Prefer.asp" METHOD="Post" ONSUBMIT="writecookie()">
  69. <table CELLSPACING="0" BORDER="1">
  70. <tr>
  71.   <td BGCOLOR="White"><font SIZE="2" FACE="Arial, Helvetica, Verdana">Background:</font></td>
  72.   <td BGCOLOR="White">
  73.     <select NAME="BGColor">
  74.       <option VALUE="AQUA">AQUA
  75.       <option VALUE="BLACK">BLACK
  76.       <option VALUE="BLUE">BLUE
  77.       <option VALUE="FUCHSIA">FUCHSIA
  78.       <option VALUE="GRAY">GRAY
  79.       <option VALUE="GREEN">GREEN
  80.       <option VALUE="LIME">LIME
  81.       <option VALUE="MAROON">MAROON
  82.       <option VALUE="NAVY">NAVY
  83.       <option VALUE="OLIVE">OLIVE
  84.       <option VALUE="PURPLE">PURPLE
  85.       <option VALUE="RED">RED
  86.       <option VALUE="SILVER">SILVER
  87.       <option VALUE="TEAL">TEAL
  88.       <option VALUE="WHITE">WHITE
  89.       <option VALUE="YELLOW">YELLOW
  90.     </select>
  91.   </td>
  92. </tr>
  93.  
  94. <tr>
  95.   <td BGCOLOR="White"><font SIZE="2" FACE="Arial, Helvetica, Verdana">Text:</font></td>
  96.   <td BGCOLOR="White">
  97.     <select NAME="FGColor">
  98.       <option VALUE="AQUA">AQUA
  99.       <option VALUE="BLACK">BLACK
  100.       <option VALUE="BLUE">BLUE
  101.       <option VALUE="FUCHSIA">FUCHSIA
  102.       <option VALUE="GRAY">GRAY
  103.       <option VALUE="GREEN">GREEN
  104.       <option VALUE="LIME">LIME
  105.       <option VALUE="MAROON">MAROON
  106.       <option VALUE="NAVY">NAVY
  107.       <option VALUE="OLIVE">OLIVE
  108.       <option VALUE="PURPLE">PURPLE
  109.       <option VALUE="RED">RED
  110.       <option VALUE="SILVER">SILVER
  111.       <option VALUE="TEAL">TEAL
  112.       <option VALUE="WHITE">WHITE
  113.       <option VALUE="YELLOW">YELLOW
  114.     </select>
  115.   </td>
  116. </tr>
  117. <tr>
  118.  <td COLSPAN="2" BGCOLOR="White" ALIGN="Center"><input TYPE="Submit" VALUE="Set">
  119.  </td>
  120. </tr>
  121. </table>
  122. </form>
  123.  
  124. This is some sample text to show the color.
  125.  
  126. <br><br>
  127.  
  128. </font>
  129. </body>
  130. </html>
  131.